home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1833 / 1833.xpi / chrome / m / yoono.com / sidebar.jar / sidebar / js / externalyoodget.js < prev    next >
Text File  |  2009-12-16  |  3KB  |  1 lines

  1. function ExternalYoodget(){this.base=Yoodget;this.base();this.requestedUpdate=false;this.refreshTimer=null;this.iframe=null;this.startUrl="http://www.yoono.com";this.wrapperUrl="chrome://yoonosb/content/wrapper.xul";this.cssPath="";this.autoRefresh=false;this.sep="?"}ExternalYoodget.prototype=new Yoodget;ExternalYoodget.prototype.init=function(){try{var a=this;Yoodget.prototype.init.call(this);if(this.startUrl.indexOf("?")!=-1){this.sep="&"}this.iframe=$("externalIframe");var a=this;yoono.event.addEventListener(this.iframe,"load",function(){a.iframeLoaded()},true);yoono.event.addEventListener(this.iframe,"click",function(c){a.checkIfLink(c)},true);if(document.all){this.iframe.setAttribute("src",this.startUrl)}else{this.iframe.setAttribute("src",this.wrapperUrl)}}catch(b){logError("ExternalYoodget.init: "+b)}};ExternalYoodget.prototype.iframeLoaded=function(){if(document.all){this.doc=this.iframe.contentWindow.document;this.documentLoaded()}else{var b=this.iframe.getAttribute("src");if(b==this.wrapperUrl){var c=this.iframe.contentWindow.document;var a=this;this.iframe=c.getElementById("wrapperIframe");yoono.event.addEventListener(this.iframe,"load",function(){a.iframeLoaded()},true);this.iframe.setAttribute("src",this.startUrl);return}else{this.doc=this.iframe.contentWindow.document;this.documentLoaded()}}};ExternalYoodget.prototype.documentLoaded=function(){try{clearInterval(this.refreshTimer);this.doc.body.style.display="none";var b=this.doc.getElementsByTagName("head");if(b&&b[0]){var a=this.doc.createElement("link");a.setAttribute("type","text/css");a.setAttribute("rel","stylesheet");var c=this.importUrl+"/"+this.cssPath;a.setAttribute("href",c);b[0].appendChild(a)}this.doc.body.style.display="block";this.setRefreshInterval();this.afterDocumentLoaded()}catch(d){logError("ExternalYoodget: "+d)}};ExternalYoodget.prototype.afterDocumentLoaded=function(){};ExternalYoodget.prototype.setRefreshInterval=function(){var a=this;if(!this.autoRefresh){return}if(this.config.RefreshInterval){var b=this.config.RefreshInterval*1000*60;if(b){this.refreshTimer=setTimeout(function(){a.reloadStartDocument()},b)}}};ExternalYoodget.prototype.reloadStartDocument=function(){clearInterval(this.refreshTimer);if(this.canRefreshNow()){this.iframe.setAttribute("src",this.startUrl+this.sep+"yoonourltstamp="+new Date().getTime())}this.setRefreshInterval()};ExternalYoodget.prototype.canRefreshNow=function(){return(this.startUrl==this.doc.location.href)};ExternalYoodget.prototype.onVisible=function(){this.wrapper.warningStop()};ExternalYoodget.prototype.checkIfLink=function(a){var c=Event.element(a);if("A"==c.nodeName){var b=c.getAttribute("href");if(this.isExternalLink(b)){this.YEXTIF.execFct("openUrl",[b]);Event.stop(a)}}};ExternalYoodget.prototype.isExternalLink=function(b){var a=false;if(0==b.indexOf("http://")){a=true}return(a)};